/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.inventory.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author sithum
 */
@Entity
@Table(name = "ITEM_DETAILS", catalog = "", schema = "APP")
@NamedQueries({@NamedQuery(name = "ItemDetails.findAll", query = "SELECT i FROM ItemDetails i"), @NamedQuery(name = "ItemDetails.findById", query = "SELECT i FROM ItemDetails i WHERE i.id = :id"), @NamedQuery(name = "ItemDetails.findBySpecial", query = "SELECT i FROM ItemDetails i WHERE i.special = :special"), @NamedQuery(name = "ItemDetails.findByPackSize", query = "SELECT i FROM ItemDetails i WHERE i.packSize = :packSize"), @NamedQuery(name = "ItemDetails.findByQohUnits", query = "SELECT i FROM ItemDetails i WHERE i.qohUnits = :qohUnits"), @NamedQuery(name = "ItemDetails.findByQohSubUnits", query = "SELECT i FROM ItemDetails i WHERE i.qohSubUnits = :qohSubUnits")})
public class ItemDetails implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "SPECIAL", nullable = false, length = 10)
    private String special;
    @Column(name = "PACK_SIZE")
    private Integer packSize;
    @Basic(optional = false)
    @Column(name = "QOH_UNITS", nullable = false)
    private int qohUnits;
    @Basic(optional = false)
    @Column(name = "QOH_SUB_UNITS", nullable = false)
    private int qohSubUnits;
    @JoinColumn(name = "ITEM_ID", referencedColumnName = "ITEM_ID", nullable = false)
    @ManyToOne(optional = false)
    private Item itemId;

    public ItemDetails() {
    }

    public ItemDetails(Integer id) {
        this.id = id;
    }

    public ItemDetails(Integer id, String special, int qohUnits, int qohSubUnits) {
        this.id = id;
        this.special = special;
        this.qohUnits = qohUnits;
        this.qohSubUnits = qohSubUnits;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getSpecial() {
        return special;
    }

    public void setSpecial(String special) {
        this.special = special;
    }

    public Integer getPackSize() {
        return packSize;
    }

    public void setPackSize(Integer packSize) {
        this.packSize = packSize;
    }

    public int getQohUnits() {
        return qohUnits;
    }

    public void setQohUnits(int qohUnits) {
        this.qohUnits = qohUnits;
    }

    public int getQohSubUnits() {
        return qohSubUnits;
    }

    public void setQohSubUnits(int qohSubUnits) {
        this.qohSubUnits = qohSubUnits;
    }

    public Item getItemId() {
        return itemId;
    }

    public void setItemId(Item itemId) {
        this.itemId = itemId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemDetails)) {
            return false;
        }
        ItemDetails other = (ItemDetails) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.inventory.entities.ItemDetails[id=" + id + "]";
    }

}
